<?php

use App\Models\User;
use Illuminate\Support\Str;
use Faker\Generator as Faker;

/*
|--------------------------------------------------------------------------
| Model Factories
|--------------------------------------------------------------------------
|
| This directory should contain each of the model factory definitions for
| your application. Factories provide a convenient way to generate new
| model instances for testing / seeding your application's database.
|
*/

$factory->define(User::class, function (Faker $faker) {
    $sex = random_int(0,1);
    $updated_at = $faker->dateTimeThisMonth();
    $created_at = $faker->dateTimeThisMonth($updated_at);
    $file_name = public_path()."/images/default.png";

    return [
        'name' => $faker->name,
        'openID' => Str::random(32),
        'sex' => $sex,
        'avatar' => $file_name,
        'created_at' => $created_at,
        'updated_at' => $updated_at,
    ];
});
